#

| Chapter 2 UNIX Commands |

## stty

    stty [options] [modes]

Set terminal I/O options for the current device. Without options, stty reports the terminal settings, where a ^ indicates the CONTROL key and ^` indicates a null value. Most modes can be switched using an optional - (shown in brackets). The corresponding description is also shown in brackets. As a privileged user, you can set or read settings from another device using the syntax:

>     stty [options] [modes] < device

### Options

-a

  Report all option settings.

-g

  Report current settings.

### control modes

0

  Hang up phone.

`n`

  Set terminal baud rate to `n` (e.g., 2400).

[-]clocal

  [Enable]disable modem control.

[-]cread

  [Disable]enable the receiver.

cs`n`

  Select character size (5-8).

[-]cstopb

  [One]two stop bits per character.

[-]hup

  [Do not]hang up connection on last close.

[-]hupcl

  Same as previous.

ispeed `n`

  Set terminal input baud rate to `n`.

[-]loblk

  [Do not]block layer output.

ospeed `n`

  Set terminal output baud rate to `n`.

[-]parenb

  [Disable]enable parity generation and detection.

[-]parext

  [Disable]enable extended parity generation and detection for mark and space parity.

[-]parodd

  Use [`even`]odd parity.

### Input modes

[-]brkint

  [Do not]signal INTR on break.

[-]icrnl

  [Do not]map carriage return (^M) to newline (^J) on input.

[-]ignbrk

  [Do not]ignore break on input.

[-]igncr

  [Do not]ignore carriage return on input.

[-]ignpar

  [Do not]ignore parity errors.

[-]imaxbel

  [Do not]echo BEL when input line is too long.

[-]inlcr

  [Do not]map newline to carriage return on input.

[-]inpck

  [Disable]enable input parity checking.

[-]istrip

  [Do not]strip input characters to seven bits.

[-]iuclc

  [Do not]map uppercase to lowercase on input.

[-]ixany

  Allow [`XON`]any character to restart output.

[-]ixoff

  [Do not]send START/STOP characters when queue is nearly empty/full.

[-]ixon

  [Disable]enable START/STOP output control.

[-]parmrk

  [Do not]mark parity errors.

### Output modes

bs`n`

  Select style of delay for backspaces (0 or 1).

cr`n`

  Select style of delay for carriage returns (0-3).

ff`n`

  Select style of delay for formfeeds (0 or 1).

nl`n`

  Select style of delay for linefeeds (0 or 1).

[-]ocrnl

  [Do not]map carriage return to newline on output.

[-]ofdel

  Set fill character to [NULL]DEL.

[-]ofill

  Delay output with [timing]fill characters.

[-]olcuc

  [Do not]map lowercase to uppercase on output.

[-]onlcr

  [Do not]map newline to carriage return-newline on output.

[-]onlret

  [Do not]perform carriage return after newline.

[-]onocr

  [Do not]output carriage returns at column zero.

[-]opost

  [Do not]postprocess output; ignore all other output modes.

tab`n`

  Select style of delay for horizontal tabs (0-3).

vt`n`

  Select style of delay for vertical tabs (0 or 1).

### Local modes

[-]echo

  [Do not]echo every character typed.

[-]echoctl

  [Do not]echo control characters as `^char`, delete as ^?.

[-]echoe

  [Do not]echo ERASE character as BS-space-BS string.

[-]echok

  [Do not]echo newline after KILL character.

[-]echoke

  [Do not]BS-SP-BS erase entire line on line kill.

[-]echonl

  [Do not]echo newline (^J).

[-]echoprt

  [Do not]echo erase character as character is "erased."

[-]flusho

  Output is [not] being flushed.

[-]icanon

  [Disable]enable canonical input (ERASE and KILL processing).

[-]iexten

  [Disable]enable extended functions for input data.

[-]isig

  [Disable]enable checking of characters against INTR, QUIT, and SWITCH.

[-]noflsh

  [Enable]disable flush after INTR, QUIT, or SWITCH.

[-]pendin

  [Do not]retype pending input at next read or input character.

[-]stappl

  [Line]application mode on a synchronous line.

[-]stflush

  [Disable]enable flush on synchronous line.

[-]stwrap

  [Enable]disable truncation on synchronous line.

[-]tostop

  [Do not]send SIGTTOU when background processes write to the terminal.

[-]xcase

  [Do not]change case on local output.

### Control assignments

`ctrl-char c`

  Set control character to `c`. `ctrl-char` is: ctab, discard, dsusp, eof, eol, eol2, erase, intr, kill, lnext, quit, reprint, start, stop, susp, swtch, werase.

min, time `n`

  Set min or time to `n`.

line `i`

  Set line discipline to `i` (1-126).

### Combination modes

async

  Set normal asynchronous communications.

cooked

  Same as -raw.

[-]evenp

  Same as [-]parenb and cs[8]7.

ek

  Reset ERASE and KILL characters to # and @.

[-]lcase

  [Un]set xcase, iuclc, and olcuc.

[-]LCASE

  Same as [-]lcase.

[-]markp

  [Disable]enable parenb, parodd, and parext and set cs[8]7.

[-]nl

  [Un]set icrnl and onlcr. -nl also unsets inlcr, igncr, ocrnl, and onlret.

[-]oddp

  Same as [-]parenb, [-]parodd, and cs7[8].

[-]parity

  Same as [-]parenb and cs[8]7.

[-]raw

  [Disable]enable raw input and output (no ERASE, KILL, INTR, QUIT, EOT, SWITCH, or output postprocessing).

sane

  Reset all modes to reasonable values.

[-]spacep

  [Disable]enable parenb and parext and set cs[8]7.

[-]tabs

  [Expand to spaces]preserve output tabs.

`term`

  Set all modes suitable for terminal type `term` (tty33, tty37, vt05, tn300, ti700, or tek).

### Hardware flow control modes

[-]rtsxoff

  [Disable]enable RTS on input.

[-]ctsxon

  [Disable]enable CTS on output.

[-]dtrxoff

  [Disable]enable DTR on input.

[-]cdxon

  [Disable]enable CD on output.

[-]isxoff

  [Disable]enable isochronous on input.

### Clock modes

[x|r]cibrg

  Get the transmit|receive clock from internal baud rate generator.

[x|r]ctset

  Get the transmit|receive clock from transmitter timing-lead, circuit 114, pin 15.

[x|r]crset

  Get the transmit|receive clock from receiver timing-lead, circuit 115, pin 17.

For modes beginning with t, `pin` is transmitter timing-lead, circuit 113, pin 24. For modes beginning with r, `pin` is receiver timing-lead, circuit 128, no pin.

[t|r]setcoff

  No transmitter|receiver timing clock.

[t|r]setcrbrg

  Send receive baud rate generator to `pin`.

[t|r]setctbrg

  Send transmit baud rate generator to `pin`.

[t|r]setctset

  Send transmitter timing to `pin`.

[t|r]setcrset

  Send receiver timing to `pin`.

### Window size

columns `n`

  Set size to `n` columns.

rows `n`

  Set size to `n` rows.

xpixels `n`

  Set size to `n` pixels across.

ypixels `n`

  Set size to `n` pixels up and down.

Reference: strip |  | Reference: su